1. Field of the Invention
The present invention relates to a moving image coding apparatus, a moving image decoding apparatus, a moving image coding method and a moving image decoding method in accordance with H.264/MPEG4-AVC is a moving image coding system standardized by ITU-T (International Telecommunication Union-Telecommunication Standardization Sector) and ISO (International Organization for Standardization).
2. Description of the Related Art
Patent Document 1 describes a way to make it possible to carry out random playback easily, by performing, when recovering a bit stream, initialization of a decoder upon the first detection of I picture following SPS information.
Patent Document 2 describes, in a moving image coded data editing apparatus that clips out coded data at an arbitrary editing point, a way to make it possible to clip out coded data from an arbitrary editing point by changing header information of coded data after the editing point to contents in which the editing point is specified as the starting point.
H.264/MPEG4-AVC Recommendation specifies Picture Order Counts (POC) that represent the order in which the pictures are to be displayed at the decoder side. Specified encoding methods for the POC include POC type 1, POC type 2 and POC type 3. The decoding process for POC coded as POC type 1 is specified as follows in 8.2.1.2 of H.264/MPEG4-AVC Recommendation:
1. Expression (8-6) in H.264/MPEG4-AVC
The variable Frame Num Offset is derived as follows:
                              if          ⁢                                          ⁢                      (                                          nal_unit                ⁢                _type                            ==              5                        )                    ⁢          FrameNumOffset                =                              0            ⁢                                                  ⁢            else            ⁢                                                  ⁢                          if              ⁡                              (                                  prevFrameNum                  >                  frame_num                                )                                      ⁢            FrameNumOffset                    =                                    prevFrameNumOffset              +                              MaxFrameNum                ⁢                                                                  ⁢                else                ⁢                                                                  ⁢                FrameNumOffset                                      =            prevFrameNumOffset                                              Expression        ⁢                                  ⁢                  (          1          )                    
The expression (1) above is for deriving Frame Num Offset, which is a process as follows.
When the NAL unit type is “5”, the frame number offset FrameNumOffset is initialized to “0”. When the NAL unit type is not “5” and the previous frame number is larger than the current frame number, the value obtained by adding the maximum frame number MaxFrameNum to prevFrameNumOffset is set as Frame Num Offset.
2. Expression (8-7) in H.264/MPEG4-AVC
The variable absFrameNum is derived as follows:
                              if          ⁢                                          ⁢                      (                                          num_ref                ⁢                _frames                ⁢                _in                ⁢                _pic                ⁢                _order                ⁢                _cnt                ⁢                _cycle                            !=              0                        )                    ⁢          absFrameNum                =                              FrameNumOffset            +                          frame_num              ⁢                                                          ⁢              else              ⁢                                                          ⁢              absFrameNum                                =                                    0              ⁢                                                          ⁢              if              ⁢                                                          ⁢                              (                                                                            nal_ref                      ⁢                      _idc                                        ==                    0                                    ⁢                                                                          &&                                                                          ⁢                                      absFrameNum                    >                    0                                                  )                            ⁢              absFrameNum                        =                          absFrameNum              -              1                                                          Expression        ⁢                                  ⁢                  (          2          )                    
The above expression (2) is for deriving absFrameNum that is the number of pictures on the basis of an IDR (Instantaneous Decoding Refresh) picture, which is a process as follows.
When num_ref_frames_in_pic_order_cnt_cycle is not “0”, the value obtained by adding the frame number frame_num to FrameNumOffset is set as absFrameNum. When num_ref_frames_in_pic_order_cnt_cycle is “0”, absFrameNum is set to “0”.
When the flag nal_ref_idc indicating whether or not it is the reference picture or not is “0” and absFrameNum is larger than “0”, the value obtained by subtracting “1” from absFrameNum is set as absFrameNum.
3. Expression (8-8) in H.264/MPEG4-AVC
When absFrameNum>0, picOrderCntCycleCnt and frameNumInPicOrderCnt Cycle are derived as follows:
                    if        ⁢                                  ⁢                  (                      absFrameNum            >            0                    )                ⁢                  {                      picOrderCntCycleCnt            =                                                                                (                                          absFrameNum                      -                      1                                        )                                    /                  num_ref                                ⁢                _frames                ⁢                _in                ⁢                _pic                ⁢                _ordercnt                ⁢                _cycleframeNumInPicOrderCntCycle                            =                                                (                                      absFramesNum                    -                    1                                    )                                ⁢                %                ⁢                                                                  ⁢                num_ref                ⁢                _frames                ⁢                _in                ⁢                _pic                ⁢                _order                ⁢                _cnt                ⁢                _cycle                                              }                                    Expression        ⁢                                  ⁢                  (          3          )                    
The above expression (3) represents a process for deriving picOrderCntCycleCnt and frameNumInPicOrderCntCycle.
4. Expression (8-9) in H.264/MPEG4-AVC
The variable expectedDeltaPerPicOrderCntCycle is derived as follows:
                    expectedDeltaPerPicOrderCntCycle        =                              0            ⁢                                                  ⁢            for            ⁢                                                  ⁢                          (                                                i                  =                  0                                ;                                  i                  <                                      num_ref                    ⁢                    _frames                    ⁢                    _in                    ⁢                    _pic                    ⁢                    _order                    ⁢                    _cnt                    ⁢                    _cycle                                                  ;                                  i                  ++                                            )                        ⁢            expectedDeltaPerPicOrderCntCycle                    +=                      offset_for            ⁢            _ref            ⁢                          _frame              ⁡                              [                i                ]                                                                        Expression        ⁢                                  ⁢                  (          4          )                    
The above expression (4) represents a process for deriving expectedDeltaPerPicOrderCntCycle. It is a process for deriving offset_for_ref_frame[i] that is determined by the value of the variable i.
5. Expression (8-10) in H.264/MPEG4-AVC
The variable expectedPicOrderCnt is derived as follows:
                              if          ⁢                                          ⁢                      (                          absFrameNum              >              0                        )                    ⁢                      {                          expectedPicOrderCnt              =                                                picOrderCntCycleCnt                  *                  expectedDeltaPerPicOrderCnt                  ⁢                                                                          ⁢                  Cycle                  ⁢                                                                                                    ⁢                                                                                                  ⁢                  for                  ⁢                                                                          ⁢                                      (                                                                  i                        =                        0                                            ;                                              i                        <=                        frameNumInPicOrderCntCycle                                            ;                                              i                        ++                                                              )                                    ⁢                  expectedPicOrderCnt                                =                                  expectedPicOrderCnt                  +                                      offset_for                    ⁢                    _ref                    ⁢                                          _frame                      ⁡                                              [                        i                        ]                                                                                                                  }                    ⁢                                          ⁢          else          ⁢                                          ⁢          expectedPicOrderCnt                =                              0            ⁢                                                  ⁢            if            ⁢                                                  ⁢                          (                                                nal_ref                  ⁢                  _idc                                ==                0                            )                        ⁢            expectedPicOrderCnt                    =                                    expectedPic              ⁢                                                          ⁢              OrderCnt                        +                          offset_for              ⁢              _non              ⁢              _ref              ⁢              _pic                                                          Expression        ⁢                                  ⁢                  (          5          )                    
When the absolute frame number absFrameNum is larger than 0 in the process in the expression (5) above, the value obtained by multiplying picOrderCntCycleCnt by expectedDeltaPerPicOrderCnt Cycle is obtained as expectedPicOrderCnt. Further, the value obtained by adding offset_for_ref_frame[i] indicating the difference for the POC of the picture to expectedPicOrderCnt is obtained as expectedPicOrderCn.
In addition, if the flag nal_ref_idc indicating whether or not it is the reference picture is 0, the value obtained by adding offset_for_non_ref_pic indicating the difference for the POC of a non-reference picture to expectedPicOrderCnt is obtained as expectedPicOrderCn.
6. Expression (8-11) in H.264/MPEG4-AVC
The variables TopFieldOrderCnt or BottomFieldOrderCnt are derived as follows:
                              if          ⁢                                          ⁢                      (                          !                              field_pic                ⁢                _flag                                      )                    ⁢                      {                          TopFieldOrderCnt              =                                                expectedPicOrderCnt                  +                                      delta_pic                    ⁢                    _order                    ⁢                                          _cnt                      ⁡                                              [                        0                        ]                                                              ⁢                    BottomFieldOrderCnt                                                  =                                  TopFieldOrderCnt                  +                                      offset_for                    ⁢                    _top                    ⁢                    _to                    ⁢                    _bottom                    ⁢                    _field                                    +                                      delta_pic                    ⁢                    _order                    ⁢                                          _cnt                      ⁡                                              [                        1                        ]                                                                                                                  }                    ⁢          else          ⁢                                          ⁢          if          ⁢                                          ⁢                      (                          !                              bottom_field                ⁢                _flag                                      )                    ⁢          TopFieldOrderCnt                =                              expectedPicOrderCnt            +                          delta_pic              ⁢              _order              ⁢                              _cnt                ⁡                                  [                  0                  ]                                            ⁢                                                                                ⁢                                                                              ⁢              else              ⁢                                                          ⁢              BottomFieldOrderCnt                                =                      expectedPicOrderCnt            +                          offset_for              ⁢              _top              ⁢              _to              ⁢              _bottom              ⁢              _field                        +                          delta_pic              ⁢              _order              ⁢                              _cnt                ⁡                                  [                  0                  ]                                                                                        Expression        ⁢                                  ⁢                  (          6          )                    
In the process of the expression (6) above, with “!field_pic_flag”, that is, if it is not a field slice, the value calculated by adding expectedPicOrderCnt and delta_pic_order_cnt[0] is obtained as TopFieldOrderCnt.
Meanwhile, types of information that the decoding apparatus can obtain from a coded stream is as follows:
nal_unit_type indicating the type of NAL unit; the frame number frame_num; the maximum frame number MaxFrameNum; num_ref_frames_in_pic_order_cnt_cycle and nal_ref_idc used for deriving a POC; offset_for_ref_frame[i], offset_for_non_ref_pic, and field_pic_flag used for deriving a type 1 POC; delta_pic_order_cnt[0], delta_pic_order_cnt[1], and bottom_field_flag used for calculating the POC.    [Patent Document 1] Japanese Laid-open Patent Publication No. 2007-318615    [Patent Document 2] Japanese Laid-open Patent Publication No. 2007-67842    [Non Patent Document 1] Ye-Kui Wang and another, JVT-F050 POC Recovery in Random Access Point SEI Message, Tampere University of Technology and Nokia Corporation.
Non Patent Document 1 proposes, in order to make it possible to perform the decoding with a random access using the exactly same POC value as in the case of the decoding for a POC type 1 started from an IDR picture, coding and sending a value obtained by dividing the frame number offset FrameNumOffset by the maximum frame number MaxFrameNum.
However, there is a problem with the above value since it requires an information amount up to 28 bits when the value is an unsigned integer, and up to 57 bits with Golomb coding, increasing the information amount to be transmitted.